home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 26 / Mac Magazin and MacEasy Magazine CD - Issue 26.iso / Wissenschaft & Technik / Mercutio_v1.3f / Sample Codeƒ / MercutioAPI.p < prev    next >
Text File  |  1996-08-27  |  17KB  |  536 lines

  1. UNIT MercutioAPI;
  2.  
  3.     {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  4.     {x                                                                         x}
  5.     {x         Developer's Programming Interface for the Mercutio MDEF         x}
  6.     {x            ©1992-1996 Ramon M. Felciano, All Rights Reserved            x}
  7.     {x                                                                         x}
  8.     {x        some original inline assembly courtesy of John Cavallino                            x}
  9.     {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  10.  
  11. INTERFACE
  12. {$ALIGN MAC68K}
  13.     USES
  14.         Types, Memory, QuickDraw, Resources, Events, Menus, ToolUtils, MixedMode;
  15.     CONST
  16.  
  17.         customDefProcSig = 'CUST';
  18.         areYouCustomMsg = ord('*') * 256 + ord('*');
  19.         getVersionMsg = ord('*') * 256 + ord('v');
  20.         getCopyrightMsg = ord('C') * 256 + ord('C');
  21.         setCallbackMsg = ord('*') * 256 + ord('c');
  22.         stripCustomDataMsg = ord('*') * 256 + ord('d');
  23.         setPrefsMsg = ord('*') * 256 + ord('p');
  24.         setKeyGraphicsMsg  = ord('*') * 256 + ord('g');
  25.         setSmallIconIDMsg = ord('*') * 256 + ord('i');
  26.         
  27.         mMenuKeyMsg = ord('S') * 256 + ord('K');        {see if key press is key-equiv for this menu}
  28.         mDrawItemStateMsg = ord('S') * 256 + ord('D');        { draw the specified item in the specifed box }
  29.         mCountItemsMsg = ord('S') * 256 + ord('C');    { return count of items in menu }
  30.  
  31.         cbBasicDataOnlyMsg = 1;
  32.         cbIconOnlyMsg = 2;
  33.         cbGetLongestItemMsg = 3;
  34.  
  35.     TYPE
  36.         flexStyle = PACKED RECORD CASE Boolean OF
  37.             false : ( s : Style );
  38.             true : ( val : SignedByte );
  39.         END;
  40.         
  41.         MenuPrefsHandle = ^MenuPrefsPtr;
  42.         MenuPrefsPtr = ^MenuPrefsRec;
  43.         MenuPrefsRec = PACKED RECORD
  44.                 isDynamicFlag, forceNewGroupFlag, useCallbackFlag, controlKeyFlag, optionKeyFlag, shiftKeyFlag, cmdKeyFlag, unused: flexStyle;
  45.                 requiredModifiers: integer;
  46.                 unused2 : UInt32; { reserved for future use }
  47.                 unused3 : UInt32; { reserved for future use }
  48.             END;
  49.  
  50.     {ItemFlagsRec: additional fields supported by Mercutio MDEFs}
  51.         ItemFlagsPtr = ^ItemFlagsRec;
  52.         ItemFlagsRec = PACKED RECORD
  53.             { high byte }
  54.                 forceNewGroup: boolean;
  55.                 isDynamic: boolean;
  56.                 useCallback: boolean;
  57.                 controlKey: boolean;
  58.                 optionKey: boolean;
  59.                 unused10: boolean;
  60.                 shiftKey: boolean;
  61.                 cmdKey: boolean;
  62.  
  63.             { low byte }
  64.                 isHier: boolean;
  65.                 changedByCallback: boolean;
  66.                 Enabled: boolean;
  67.                 hilited: boolean;
  68.                 iconIsSmall: boolean;
  69.                 hasIcon: boolean;
  70.                 sameAlternateAsLastTime:boolean;
  71.                 dontDisposeIcon: boolean;
  72.             END;
  73.  
  74.     {StdItemData: record structure from the standard menu item structure}
  75.         RichItemData = PACKED RECORD
  76.                 iconID: Byte;        { resource ID of the icon to display (0 if none) }
  77.                 keyEq: char;        { keyboard equivalent (or special control value) }
  78.                 mark: char;        { mark character, (chr(0) if none) }
  79.                 textStyle: flexStyle; { text style of the item }
  80.                 itemID: integer;    { index position within the menu }
  81.                 itemRect: Rect;        { where the item will be drawn }
  82.                 flags: ItemFlagsRec;    { special Mercutio flags }
  83.                 iconType: ResType;    { resource type of the icon (used for disposing of icon data)}
  84.                 hIcon: Handle;        { Handle to the icon data }
  85.                 pString: StringPtr;    { points to itemStr, or to string in MenuHandle }
  86.                 itemStr: Str255;    { used for callback string passing }
  87.                 cbMsg: integer;        { callback message }
  88.             END;
  89.         RichItemPtr = ^RichItemData;
  90.  
  91.     CONST
  92.         uppMercutioCallbackProcInfo = $00000E80; { UPP for Mercutio callback procedure }
  93.  
  94.     TYPE
  95.     {$IFC PROCTYPE }
  96.         MercutioCallbackProcPtr = PROCEDURE (menuID: integer; previousModifiers: integer; VAR itemData: RichItemData);
  97.     {$ELSEC}
  98.         MercutioCallbackProcPtr = ProcPtr;  { PROCEDURE MyGetItemInfo (menuID: integer; previousModifiers: integer; VAR itemData: RichItemData); }
  99.     {$ENDC}
  100.         MercutioCallbackUPP = UniversalProcPtr;
  101.  
  102.  
  103. {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  104. {x}
  105. {x    MDEF_MenuKey is a replacement for the standard toolbox call MenuKey for use with the}
  106. {x    Mercutio MDEF. Given the keypress message and modifiers parameters from a standard event, it }
  107. {x    checks to see if the keypress is a key-equivalent for a particular menuitem. If you are currently}
  108. {x    using custom menus (i.e. menus using a Mercutio MDEF), pass the Handle to one of these menus in}
  109. {x    hMenu. If you are not using custom menus, pass in NIL or another menu, and MDEF_MenuKey will use the}
  110. {x    standard MenuKey function to interpret the keypress.}
  111. {x}
  112. {x    As with MenuKey, MDEF_MenuKey returns the menu ID in high word of the result, and the menu}
  113. {x    item in the low word.}
  114. {x}
  115. {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  116.  
  117.     FUNCTION MDEF_MenuKey (theMessage: longint; theModifiers: integer; hMenu: MenuHandle): longint;
  118.  
  119.  
  120. {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  121. {x}
  122. {x    These routines allow you to retrieve the Copyright and Version information}
  123. {x    embedded within the MDEF. The Version information is returned as a longint,}
  124. {x    which can be typecast to a normal version resource.}
  125. {x}
  126. {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  127.  
  128.     FUNCTION MDEF_GetCopyright (menu: MenuHandle): Str255;
  129.     FUNCTION MDEF_GetVersion (menu: MenuHandle): longint;
  130.  
  131.  
  132. {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  133. {x}
  134. {x    MDEF_CalcItemSize will calculate the height and width for a given menu item. It assumes the top and}
  135. {x    left fields of theRect are filled in; the MDEF will fill in the bottom and right.}
  136. {x}
  137. {x    MDEF_DrawItem will draw a given item in the rectangle you specify. You can indicate whether the}
  138. {x    the item should be hilited or enabled.}
  139. {x}
  140. {x    MDEF_DrawItemState is similar but allows you to draw the item disabled or hilited.}
  141. {x}
  142. {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  143.  
  144.     PROCEDURE MDEF_CalcItemSize (menu: MenuHandle; item: integer; VAR theRect: Rect);
  145.     PROCEDURE MDEF_DrawItem (menu: MenuHandle; item: integer; destRect: Rect);
  146.     PROCEDURE MDEF_DrawItemState (menu: MenuHandle; item: integer; destRect: Rect; hilited, enabled: boolean);
  147.  
  148. {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  149. {x}
  150. {x    MDEF_StripCustomMenuData will remove any custom data allocated by the Mercutio MDEFs. Use this}
  151. {x    before writing a MENU resource to disk (esp. if you are using callbacks)}
  152. {x}
  153. {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  154.     PROCEDURE MDEF_StripCustomMenuData (menu: MenuHandle);
  155.  
  156.  
  157.  
  158. {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  159. {x}
  160. {x    MDEF_SetCallbackProc sets the procedure that will be called for each item before it is drawn. The}
  161. {x    procedure is also called during the SizeMenu message call.}
  162. {x}
  163. {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  164. {    PROCEDURE MDEF_SetCallbackProc (menu: MenuHandle; theProc: ProcPtr);}
  165.     PROCEDURE MDEF_SetCallbackProc (menu: MenuHandle; theProc: MercutioCallbackUPP);
  166.  
  167.  
  168. {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  169. {x}
  170. {x    MDEF_SetMenuPrefs lets you determine which style bits for the menuItems will be interepreted}
  171. {x    as feature flags for the MDEF.}
  172. {x}
  173. {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  174.     PROCEDURE MDEF_SetMenuPrefs (menu: MenuHandle; pPrefs: MenuPrefsPtr);
  175.  
  176.     PROCEDURE MDEF_SetKeyGraphicsPreference (menu: MenuHandle; preferGraphics: boolean);
  177.     PROCEDURE MDEF_SetSmallIconIDPreference (menu: MenuHandle; iconsSmallAboveID: integer);
  178.  
  179.     FUNCTION NewMercutioCallback(userRoutine: MercutioCallbackProcPtr) : MercutioCallbackUPP;
  180.     {$IFC NOT GENERATINGCFM }
  181.     INLINE $2E9F;
  182.     {$ENDC}
  183.     PROCEDURE CallGetItemInfo (menuID: integer; previousModifiers: integer; VAR itemData: RichItemData; defProc: ProcPtr);
  184. {$IFC NOT POWERPC}
  185.     INLINE
  186.         $205F,    { move.l (SP)+,A0 }
  187.         $4E90;    { jsr (A0) }
  188. (*{$ELSEC}
  189.     VAR
  190.         callbackUPP : MercutioCallbackUPP;
  191.     BEGIN
  192.         callbackUPP := NewMercutioCallback(NewRoutineDescriptor(defProc, uppMenuDefProcInfo, kM68kISA));
  193.         CallMenuDefProc(message, theMenu, menuRect, hitPt, whichItem, menuProcUPP);    
  194.         DisposeRoutineDescriptor(menuProcUPP);
  195.     END;*)
  196.     
  197. {$ENDC}
  198.  
  199.  
  200. IMPLEMENTATION
  201.  
  202.     FUNCTION NewMercutioCallback(userRoutine: MercutioCallbackProcPtr) : MercutioCallbackUPP;
  203.         BEGIN
  204.         {$IFC GENERATINGCFM }
  205.             NewMercutioCallback := NewRoutineDescriptor(ProcPtr(@userRoutine), uppMercutioCallbackProcInfo, GetCurrentArchitecture);
  206.         {$ENDC}
  207.         END;
  208.  
  209.     
  210.     PROCEDURE CallMDEF (message: integer; theMenu: MenuHandle; VAR menuRect: Rect; hitPt: Point; VAR whichItem: integer; defProc: ProcPtr);
  211.     {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  212.     {x    Simple inline assembly code to call an MDEF, courtesy of John Cavallino. }
  213.     {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  214. {$IFC NOT POWERPC}
  215.     INLINE
  216.         $205F,    { move.l (SP)+,A0 }
  217.         $4E90;    { jsr (A0) }
  218. {$ELSEC}
  219.     VAR
  220.         menuProcUPP : MenuDefUPP;
  221.     BEGIN
  222.         menuProcUPP := MenuDefUPP(NewRoutineDescriptor(defProc, uppMenuDefProcInfo, kM68kISA));
  223.         CallMenuDefProc(message, theMenu, menuRect, hitPt, whichItem, menuProcUPP);    
  224.         DisposeRoutineDescriptor(menuProcUPP);
  225.     END;
  226. {$ENDC}
  227.  
  228.  
  229.  
  230.     PROCEDURE MDEF_SetMenuPrefs (menu: MenuHandle; pPrefs: MenuPrefsPtr);
  231.         VAR
  232.             state: SignedByte;
  233.             proc: Handle;
  234.             dummyRect: Rect;
  235.             dummyInt: integer;
  236.     BEGIN
  237.         proc := menu^^.menuProc;
  238.         state := HGetState(proc);
  239.         HLock(proc);
  240.         dummyInt := 0;
  241.         dummyRect.topLeft := Point(longint(0));
  242.         dummyRect.botRight := Point(longint(0));
  243.         CallMDEF(setPrefsMsg, menu, dummyRect, Point(pPrefs), dummyInt, proc^);
  244.         HSetState(proc, state);
  245.         CalcMenuSize(menu);    { size may have changed based on new Prefs }
  246.     END;
  247.  
  248.  
  249.     PROCEDURE MDEF_SetKeyGraphicsPreference (menu: MenuHandle; preferGraphics: boolean);
  250.         VAR
  251.             state: SignedByte;
  252.             proc: Handle;
  253.             dummyRect: Rect;
  254.             dummyPt: Point;
  255.             dummyInt: integer;
  256.     BEGIN
  257.         proc := menu^^.menuProc;
  258.         state := HGetState(proc);
  259.         HLock(proc);
  260.         dummyPt.h := Byte(preferGraphics);
  261.         dummyPt.v := 0;
  262.         CallMDEF(setKeyGraphicsMsg, menu, dummyRect, dummyPt, dummyInt, proc^);
  263.         HSetState(proc, state);
  264.     END;
  265.  
  266.  
  267.     PROCEDURE MDEF_SetSmallIconIDPreference (menu: MenuHandle; iconsSmallAboveID: integer);
  268.         VAR
  269.             state: SignedByte;
  270.             proc: Handle;
  271.             dummyRect: Rect;
  272.             dummyPt: Point;
  273.     BEGIN
  274.         proc := menu^^.menuProc;
  275.         state := HGetState(proc);
  276.         HLock(proc);
  277.         dummyPt := Point(longint(0));
  278.         dummyRect.topLeft := Point(longint(0));
  279.         dummyRect.botRight := Point(longint(0));
  280.         CallMDEF(setSmallIconIDMsg, menu, dummyRect, dummyPt, iconsSmallAboveID, proc^);
  281.         HSetState(proc, state);
  282.     END;
  283.  
  284.  
  285. {    PROCEDURE MDEF_SetCallbackProc (menu: MenuHandle; theProc: ProcPtr);}
  286.     PROCEDURE MDEF_SetCallbackProc (menu: MenuHandle; theProc: MercutioCallbackUPP);
  287.         VAR
  288.             state: SignedByte;
  289.             proc: Handle;
  290.             dummyRect: Rect;
  291.             dummyInt: integer;
  292.     BEGIN
  293.         proc := menu^^.menuProc;
  294.         state := HGetState(proc);
  295.         HLock(proc);
  296.         dummyInt := 0;
  297.         dummyRect.topLeft := Point(longint(0));
  298.         dummyRect.botRight := Point(longint(0));
  299.         CallMDEF(setCallbackMsg, menu, dummyRect, Point(theProc), dummyInt, proc^);
  300.         
  301.         HSetState(proc, state);
  302.     END;
  303.  
  304.  
  305.  
  306.     PROCEDURE MDEF_StripCustomMenuData (menu: MenuHandle);
  307.         VAR
  308.             state: SignedByte;
  309.             proc: Handle;
  310.             dummyPt: Point;
  311.             dummyItem: integer;
  312.             dummyRect: Rect;
  313.     BEGIN
  314.         dummyPt.h := 0;
  315.         dummyPt.v := 0;
  316.         proc := menu^^.menuProc;
  317.         state := HGetState(proc);
  318.         HLock(proc);
  319.         CallMDEF(stripCustomDataMsg, menu, dummyRect, dummyPt, dummyItem, proc^);
  320.         HSetState(proc, state);
  321.     END;
  322.  
  323.  
  324.  
  325.     PROCEDURE MDEF_DrawItem (menu: MenuHandle; item: integer; destRect: Rect);
  326.         VAR
  327.             state: SignedByte;
  328.             proc: Handle;
  329.             dummyPt: Point;
  330.     BEGIN
  331.         dummyPt.h := 0;
  332.         dummyPt.v := 0;
  333.         proc := menu^^.menuProc;
  334.         state := HGetState(proc);
  335.         HLock(proc);
  336.         CallMDEF(mDrawItemMsg, menu, destRect, dummyPt, item, proc^);
  337.         HSetState(proc, state);
  338.     END;
  339.  
  340.  
  341.  
  342.     PROCEDURE MDEF_DrawItemState (menu: MenuHandle; item: integer; destRect: Rect; hilited, enabled: boolean);
  343.         VAR
  344.             state: SignedByte;
  345.             proc: Handle;
  346.             dummyPt: Point;
  347.     BEGIN
  348.         proc := menu^^.menuProc;
  349.         state := HGetState(proc);
  350.         HLock(proc);
  351.         dummyPt.h := Byte(hilited);
  352.         dummyPt.v := Byte(enabled);
  353.         CallMDEF(mDrawItemStateMsg, menu, destRect, dummyPt, item, proc^);
  354.         HSetState(proc, state);
  355.     END;
  356.  
  357.  
  358.  
  359.     PROCEDURE MDEF_CalcItemSize (menu: MenuHandle; item: integer; VAR theRect: Rect);
  360.         VAR
  361.             state: SignedByte;
  362.             proc: Handle;
  363.             dummyPt: Point;
  364.     BEGIN
  365.         dummyPt.h := 0;
  366.         dummyPt.v := 0;
  367.         proc := menu^^.menuProc;
  368.         state := HGetState(proc);
  369.         HLock(proc);
  370.         CallMDEF(mCalcItemMsg, menu, theRect, dummyPt, item, proc^);
  371.         HSetState(proc, state);
  372.     END;
  373.  
  374.  
  375.  
  376.     FUNCTION MDEF_IsCustom (menu: MenuHandle): boolean;
  377.     {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  378.     {x}
  379.     {x    MDEF_IsCustom returns true if hMenu is controlled by a custom MDEF. This relies on my}
  380.     {x    convention of returning the customDefProcSig constant in the Rect parameter: this obtuse}
  381.     {x    convention should be unique enough that only my custom MDEFs behave this way.}
  382.     {x}
  383.     {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
  384.         VAR
  385.             state: SignedByte;
  386.             proc: Handle;
  387.             dummy: Rect;
  388.             dummyInt: integer;
  389.             hRes: Handle;
  390.     BEGIN
  391.         proc := menu^^.menuProc;
  392.         hRes := GetResource('MDEF', 0);
  393.         IF hRes^ = proc^ THEN
  394.             MDEF_IsCustom := false
  395.         ELSE
  396.             BEGIN
  397.                 state := HGetState(proc);
  398.                 HLock(proc);
  399.                 dummy.topLeft := Point(longint(0));
  400.                 CallMDEF(areYouCustomMsg, menu, dummy, Point(longint(0)), dummyInt, proc^);
  401.                 HSetState(proc, state);
  402.                 MDEF_IsCustom := longint(dummy.topLeft) = longint(customDefProcSig);
  403.             END;
  404.     END;
  405.  
  406.  
  407.     FUNCTION MDEF_GetVersion (menu: MenuHandle): longint;
  408.         VAR
  409.             state: SignedByte;
  410.             proc: Handle;
  411.             dummy: Rect;
  412.             dummyInt: integer;
  413.     BEGIN
  414.         proc := menu^^.menuProc;
  415.         state := HGetState(proc);
  416.         HLock(proc);
  417.         dummy.topLeft := Point(longint(0));
  418.         CallMDEF(getVersionMsg, menu, dummy, Point(longint(0)), dummyInt, proc^);
  419.         HSetState(proc, state);
  420.         MDEF_GetVersion := longint(dummy.topLeft);
  421.     END;
  422.  
  423.     FUNCTION MDEF_GetCopyright (menu: MenuHandle): Str255;
  424.         VAR
  425.             state: SignedByte;
  426.             proc: Handle;
  427.             dummy: Rect;
  428.             dummyInt: integer;
  429.             hCopyright: StringHandle;
  430.             s : Str255;
  431.     BEGIN
  432.         s := '';
  433.         proc := menu^^.menuProc;
  434.         state := HGetState(proc);
  435.         HLock(proc);
  436.         dummy.topLeft := Point(longint(0));
  437.         CallMDEF(getCopyrightMsg, menu, dummy, Point(longint(0)), dummyInt, proc^);
  438.         HSetState(proc, state);
  439.         hCopyright := StringHandle(dummy.topLeft);
  440.         IF hCopyright <> NIL THEN
  441.             s := hCopyright^^;
  442.         DisposeHandle(Handle(hCopyright));
  443.         MDEF_GetCopyright := s;
  444.     END;
  445.  
  446.  
  447.  
  448.     FUNCTION MDEF_MenuKey (theMessage: longint; theModifiers: integer; hMenu: MenuHandle) : longint;
  449.         VAR
  450.             state: SignedByte;
  451.             proc: Handle;
  452.             dummyRect: Rect;
  453.             dummyInt: integer;
  454.     BEGIN
  455.         IF ((hMenu = NIL) | (NOT MDEF_IsCustom(hMenu))) THEN
  456.             MDEF_MenuKey := MenuKey(char(BitAnd(theMessage, charCodeMask)))
  457.         ELSE
  458.             BEGIN
  459.                 proc := hMenu^^.menuProc;
  460.                 state := HGetState(proc);
  461.                 HLock(proc);
  462.                 dummyRect.topLeft := Point(longint(0));
  463.                 CallMDEF(mMenuKeyMsg, hMenu, dummyRect, Point(theMessage), theModifiers, proc^);
  464.                 HSetState(proc, state);
  465.                 MDEF_MenuKey := longint(dummyRect.topLeft);
  466.             END;
  467.     END;
  468.  
  469.  
  470. {$ALIGN RESET}
  471.  
  472.  
  473. { VERSION HISTORY }
  474. {1.2.1}
  475. {=====}
  476. { - Fixed comments (removed PowerMenuKey references)}
  477. { - Removed spaces from filenames for MetroWerks compatibility}
  478. { - Mercutio now correctly deals with variable sized cicns}
  479.  
  480. {1.2b27}
  481. {=====}
  482. { - MDEF recognized by ID (19999) rather than by resource name}
  483. { - Color icons now drawn unhilited when item is hilited (matches Apple menu behavior)}
  484. { - Fixed option character in font (should be ^, not -^-)}
  485. { - KNOWN BUG: doesn't react to GrafPort font info (e.g. for making 9 pt Geneva popup menus)}
  486.  
  487.  
  488. {1.2b26}
  489. {=====}
  490. { - Fixed scroll bug that wouldn't hilight the last item in a menu after scrolling down}
  491. { - Misc. code cleaning}
  492. { - Added 'Xmnu' menu to demonstrate preference resource}
  493. { - Removed flicker in dynamic items when they don't change}
  494.  
  495.  
  496. {1.2b24}
  497. {=====}
  498. { - Dvorak keyboard support}
  499. { - Fixed Balloon help flickering}
  500. { - Added cbGetLongestItemMsg message to callback}
  501. { - Misc bug fixes and code cleanups}
  502.  
  503.  
  504. {1.2b21}
  505. {=====}
  506. { - Xmnu id 0 as a defaults for all the menus}
  507.  
  508. {1.2b16}
  509. {=====}
  510. { - fixed color menu bug (drew background in white)}
  511. { - change callback procedure to accept a parameter block with cbMsg message}
  512. { - callback called twice: once for item data, once for icon data}
  513. { - renamed API for consistency (all routines start with MDEF_ )}
  514. { - PowerMenuKey renamed MDEF_MenuKey}
  515. {}
  516.  
  517. {1.2b12}
  518. {=====}
  519. { - integrated all MDEFs back into Mercutio}
  520. { - introduced Menu preferences for setting style bit mapping and required modifier keys}
  521. { - new 'dirty' parameter to Callback avoids unnecessary flicker }
  522. { - modifer parameter in Callback changed to Status to allow information to persist across calls }
  523. {}
  524.  
  525.  
  526. {Older versions}
  527. {==============}
  528. {11/13/92    1.1.1    Fixed keyTrans bug (w. Dvorak keyboard)}
  529. {1.1.2    Built C API, works with on-the-fly menus}
  530. {1.1.3    Added Copyright support}
  531. {1.1.4    Fixed popup bug, works with Greg's buttons}
  532. {1.1.5    Fixed bug with 'empty' mctbs; removed debugging code (alternate way to show disabled modifiers)}
  533. {2/21/93    1.2    Added icon suite support; renumbered MDEF font to resolve conflict with Geneva}
  534.  
  535. END.
  536.